﻿using System;
using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls;

namespace Testing
{
    public class SlotMachineItem : TextItem
    {
        private static Stack<SlotMachineItem> items = new Stack<SlotMachineItem>();

        public static void DisposeItems()
        {
            foreach (var item in items)
            {
                item.Dispose();
            }
            items.Clear();
        }

        public static SlotMachineItem GetItem()
        {
            if (items.Count > 0)
            {
                return items.Pop();
            }
            else
            {
                return new SlotMachineItem();
            }
        }

        protected static void ReleaseItem(SlotMachineItem item)
        {
            items.Push(item);
        }

        protected override void Release()
        {
            base.Release();
            ReleaseItem(this);
        }

    }
}
